package org.gdstash.character;

import org.gdstash.file.GDWriter;
import java.io.IOException;
import org.gdstash.file.GDReader;

public class GDCharSubSkill
{
    private String name;
    private String autoCastSkill;
    private String autoCastController;
    private String parentSkill;
    
    public void read() throws IOException {
        this.name = GDReader.readEncString();
        this.autoCastSkill = GDReader.readEncString();
        this.autoCastController = GDReader.readEncString();
        this.parentSkill = GDReader.readEncString();
    }
    
    public void write() throws IOException {
        GDWriter.writeString(this.name);
        GDWriter.writeString(this.autoCastSkill);
        GDWriter.writeString(this.autoCastController);
        GDWriter.writeString(this.parentSkill);
    }
    
    public int getByteSize() {
        int size = 0;
        size += 4;
        if (this.name != null) {
            size += this.name.length();
        }
        size += 4;
        if (this.autoCastSkill != null) {
            size += this.autoCastSkill.length();
        }
        size += 4;
        if (this.autoCastController != null) {
            size += this.autoCastController.length();
        }
        size += 4;
        if (this.parentSkill != null) {
            size += this.parentSkill.length();
        }
        return size;
    }
}
